package com.sw.study.email.controller;

import com.sw.study.email.service.CodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/code")
public class CodeController {

    @Autowired
    private CodeService codeService;


    @Value("${server.port}")
    private Integer port;

    //⽣成验证码并发送到对应邮箱，成功
    //true，失败false
    @GetMapping("/create/{email}")
    public Boolean createEmail(@PathVariable String email) {

        codeService.codeSave(email);
        return true;
    }
}
